package service;


import dao.BookDao;
import dao.domain.Book;
import dao.impl.BookDaoImpl;

import java.sql.SQLException;
import java.util.List;

/**
 * @author gzb
 */
public class BookService {

    private static final BookDao BOOK_DAO = new BookDaoImpl();

    /**
     * 在数据库中搜索书对象数据
     *
     * @param number 书号
     * @return 书对象
     */
    public static Book selectById(int number) throws SQLException {
        return BOOK_DAO.selectById(number);
    }

    public static boolean delete(Book book) throws SQLException {
        return BOOK_DAO.delete(book);
    }

    public static void save(Book book) throws SQLException {
        BOOK_DAO.save(book);
    }

    public static List<Book> searchBooks(Book book) throws SQLException {
        return BOOK_DAO.searchBooks(book);
    }


    public static void update(Book book) throws SQLException {
        BOOK_DAO.update(book);
    }
}
